package test.t1;

public class test_one {
    public static int SunRecursive(int n){
        if (n<1){
            throw new IllegalArgumentException("N必须大于0");
        }
        if (n==1){
            return 1;

        }
        return n+SunRecursive(n-1);
    }

    public static void main(String[] args) {
        int n=100;
        System.out.println("1到"+n+"的和: "+SunRecursive(n));
    }
}

